from rest_framework import serializers

from goods.models import SPUSpecification
from goods.models import SPU



#规格序列化器
class SpecsSerialzier(serializers.ModelSerializer):
    spu=serializers.StringRelatedField(read_only=True)
    spu_id=serializers.IntegerField()
    class Meta:
        model=SPUSpecification
        fields="__all__"

#商品spu序列化器
class SPUSerialzier(serializers.ModelSerializer):
    class Meta:
        model=SPU
        fields=("id","name")
